import { MockMethod } from 'vite-plugin-mock';
import { resultSuccess } from '../_util';
import { mock } from 'mockjs';

const templateList = mock({
  'data|30': [
    {
      classId: '@increment',
      className: '@ctitle(6)',
      sort: '@integer(0,2)',
      createTime: '@date(yyyy-MM-dd HH:mm:ss)',
    },
  ],
});
const templateInfo = mock({
  classId: '@increment',
  className: '@ctitle(6)',
  list: [
    {
      attrId: 1,
      attrName: '款式',
      sort: 0,
      inputType: '1',
      inputVal: '24,25',
    },
  ],
  sort: '@integer(0,2)',
  createTime: '@date(yyyy-MM-dd HH:mm:ss)',
});

export default [
  {
    url: '/mock-api/v1/goods/attrTemplate/page',
    method: 'post',
    response: () => {
      return resultSuccess({ list: templateList.data.slice(0, 6), total: 6 });
    },
  },
  {
    url: '/mock-api/v1/goods/attrTemplate/info',
    method: 'post',
    response: () => {
      return resultSuccess(templateInfo);
      // return resultSuccess({ list: templateList.data.slice(0, 6), total: 6 });
    },
  },
] as MockMethod[];
